var express = require('express');
var router = express.Router();
var util = require('../util/util')
var dao = require('../dao/dao');

/* GET users listing. */
router.get('/', function(req, res, next) {
    if(util.removeFavicon(req, res)) {
        util.logInfo(0, '/', 'GET', req.query);
        dao.getEnquiryPage(req, res);
    }
});

//查询记录
router.get('/query', function(req, res, next) {
    if(util.removeFavicon(req, res)) {
        util.logInfo(0, '/query', 'GET', req.query);
        dao.enquiry(req, res);
    }
});

//查询记录数目
router.get('/count', function(req, res, next) {
    if(util.removeFavicon(req, res)) {
        util.logInfo(0, '/count', 'GET', req.query);
        dao.enquiryCount(req, res);
    }
});

//查询部门
router.get('/department', function(req, res, next) {
    if(util.removeFavicon(req, res)) {
        util.logInfo(0, '/department', 'GET', req.query);
        dao.getDepartment(req, res);
    }
});

//查询供应商
router.get('/company', function(req, res, next) {
    if(util.removeFavicon(req, res)) {
        util.logInfo(0, '/company', 'GET', req.query);
        dao.getCompany(req, res);
    }
});

module.exports = router;
